#ifndef __defines_h__
#define __defines_h__

#include <vector>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <string>
#include <set>

const std::string  STATE_STR = "state";
const std::string  PARALLEL_STR = "parallel";
const std::string  FINAL_STR = "final";
const std::string  INITIAL_STR = "initial";
const std::string  TRANSITION_STR = "transition";

const std::string statestr[] =  {STATE_STR, PARALLEL_STR, FINAL_STR, ""};
const std::string trstr[] = {TRANSITION_STR,""};
const std::string initstr[] = {INITIAL_STR,""};

template<typename T>
void PrintVector(std::ostream& ostr, const std::vector<T>& t,
		 const char* delim = "\n")
{
  std::copy(t.begin(), t.end(), std::ostream_iterator<T>(ostr, delim));
}

template<typename T>
void PrintSet(std::ostream& ostr, const std::set<T>& t,
		 const char* delim = "\n")
{
  std::copy(t.begin(), t.end(), std::ostream_iterator<T>(ostr, delim));
}


template<class Container>
void showSequence(const Container& s, const char* sep = " ",
		  std::ostream& where = std::cout) {
  typename Container::const_iterator iter = s.begin();
  while(iter != s.end())
    where << *iter++ << sep;
  where << std::endl;
}


#include "log4cxx/logger.h"
using namespace log4cxx::helpers;
using namespace log4cxx;

template<class Container>
void logSequence(const Container& s, const char *title="", const char* sep = " ")
{
    std::ostringstream Message;
    LoggerPtr    logger(Logger::getLogger("MyApp"));

    LOG4CXX_TRACE(logger, "logging sequence - " << title << " (" << s.size() << ")");

    typename Container::const_iterator iter = s.begin();
    while(iter != s.end())
	Message << *iter++ << sep;
    LOG4CXX_TRACE(logger, Message.str());
}

#define DEBUG
#ifndef DEBUG
#define ASSERT(x)
#else
#define ASSERT(x)					\
  if (! (x))						\
    {							\
      cout << "ERROR!! Assert " << #x << " failed\n";	\
      cout << " on line " << __LINE__  << "\n";		\
      cout << " in file " << __FILE__ << "\n";		\
    }
#endif

#endif
